class User{
    readonly id:number
    name:string;
    private age:number=0;
    gender:"男"|"女" = "男"
    pid?:string
    private publishNumber:number = 3; // 每天一共可以发布数量
    curNumber:number = 0; // 当前可发布数量
    constructor(name:string,age:number,gender:"男"|"女"="男"){
        this.name = name;
        this.age= age;
        this.id = Math.random()*100000
    }
    publish(title:string){
        if(this.curNumber<this.publishNumber){
            console.log("发布文章")
            this.curNumber+=1
        }else{
            console.log("达到上线")
        }
    }
    get Age(){
        console.log(this.age)
        return this.age 
    }
    set Age(age:number){
        if(age<0 ){
            age = 0
        } else if(age>100){
            this.age =100
        }
       this.age= age
    }
}
let user = new User("aa",23)
user.publish("aa1")
user.publish("aa2")
user.publish("aa3")
user.publish("aa4")
user.publish("aa5")
user.Age=12
user.Age
